
package com.android.test.util;

import com.android.test.R;
import com.android.test.activity.MenuAboutActivity;
import com.android.test.activity.MenuProfileActivity;
import com.android.test.activity.MenuSettingActivity;

import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.MenuItem;

public class OptionsMenu {
    private final static int SETTING_ID = Menu.FIRST;

    private final static int PROFILE_ID = Menu.FIRST + 1;

    private final static int FEEDBACK_ID = Menu.FIRST + 2;

    private final static int ABOUT_ID = Menu.FIRST + 3;

    public static boolean onCreateOptionsMenu(Menu menu) {
        menu.add(0, SETTING_ID, 0, R.string.menu_setting).setIcon(R.drawable.setting);
        menu.add(0, PROFILE_ID, 0, R.string.menu_profile).setIcon(R.drawable.profile);
        menu.add(0, FEEDBACK_ID, 0, R.string.menu_feedback).setIcon(R.drawable.contact);
        menu.add(0, ABOUT_ID, 0, R.string.menu_about).setIcon(R.drawable.icon_about);
        return true;
    }

    public static boolean onOptionsItemSelected(Activity activity, MenuItem item) {
        Intent intent = new Intent();
        switch (item.getItemId()) {
            case SETTING_ID:
                intent.setClass(activity, MenuSettingActivity.class);
                break;
            case PROFILE_ID:
                intent.setClass(activity, MenuProfileActivity.class);
                break;
            case FEEDBACK_ID:
                /* intent.setClass(activity, ActivityMenuFeedback.class); */
            	intent = null;
                break;
            case ABOUT_ID:
                intent.setClass(activity, MenuAboutActivity.class);
                break;
        }
        if(intent!=null){
        	activity.startActivity(intent);
        }
        return true;
    }
}
